﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsApplication1
{
    class SimulationStats
    {
        private int hand;
        public int Hand
        {
            get { return hand; }
            set { hand = value; }
        }

        private int shoes;
        public int Shoes
        {
            get { return shoes; }
            set { shoes = value; }
        }

        private int pushes;
        public int Pushes
        {
            get { return pushes; }
            set { pushes = value; }
        }

        private int splits;
        public int Splits
        {
            get { return splits; }
            set { splits = value; }
        }

        private int pushingDoubles;
        public int PushingDoubles
        {
            get { return pushingDoubles; }
            set { pushingDoubles = value; }
        }

        private int numberOfErrors;
        public int NumberOfErrors
        {
            get { return numberOfErrors; }
            set { numberOfErrors = value; }
        }
        
        private int totalNonPushingHands;
        public int TotalNonPushingHands
        {
            get { return totalNonPushingHands; }
            set { totalNonPushingHands = value; }
        }

        private int dealerWins;
        public int DealerWins
        {
            get { return dealerWins; }
            set { dealerWins = value; }
        }

        private double dealerProbability;
        public double DealerProbability
        {
            get { return dealerProbability; }
            set { dealerProbability = value; }
        }

        private double costWeightedDealerWin;
        public double CostWeightedDealerWin
        {
            get { return costWeightedDealerWin; }
            set { costWeightedDealerWin = value; }
        }

        private int playerWins;
        public int PlayerWins
        {
            get { return playerWins; }
            set { playerWins = value; }
        }

        private int playerBlackJacks;
        public int PlayerBlackJacks
        {
            get { return playerBlackJacks; }
            set { playerBlackJacks = value; }
        }

        private int winningDoubles;
        public int WinningDoubles
        {
            get { return winningDoubles; }
            set { winningDoubles = value; }
        }

        private int losingDoubles;
        public int LosingDoubles
        {
            get { return losingDoubles; }
            set { losingDoubles = value; }
        }

        private double playerProbability;
        public double PlayerProbability
        {
            get { return playerProbability; }
            set { playerProbability = value; }
        }

        private double costWeightedPlayerWin;
        public double CostWeightedPlayerWin
        {
            get { return costWeightedPlayerWin; }
            set { costWeightedPlayerWin = value; }
        }

        private double highestBet;
        public double HighestBet
        {
            get { return highestBet; }
            set { highestBet = value; }
        }

        private double highestCount;
        public double HighestCount
        {
            get { return highestCount; }
            set { highestCount = value; }
        }

        private double lowestCount;
        public double LowestCount
        {
            get { return lowestCount; }
            set { lowestCount = value; }
        }

        private double lowestBankroll;
        public double LowestBankroll
        {
            get { return lowestBankroll; }
            set { lowestBankroll = value; }
        }

        private double highestBankroll;
        public double HighestBankroll
        {
            get { return highestBankroll; }
            set { highestBankroll = value; }
        }

        private double insuranceBetsLost;
        public double InsuranceBetsLost
        {
            get { return insuranceBetsLost; }
            set { insuranceBetsLost = value; }
        }

        private double insuranceBetsWon;
        public double InsuranceBetsWon
        {
            get { return insuranceBetsWon; }
            set { insuranceBetsWon = value; }
        }

        public double CalculateDealerWinOnDouble()
        {
            return (double)this.LosingDoubles / this.TotalNonPushingHands;
        }

        public double CalculateDealerWinStraight()
        {
            return (double)(this.DealerWins - this.LosingDoubles) / this.TotalNonPushingHands;
        }

        public double CalculateDealerProb()
        {
            this.DealerProbability = (double)this.DealerWins / this.TotalNonPushingHands;
            return this.DealerProbability;
        }

        public double CalculateCostWeightedDealerWin()
        {
            this.CostWeightedDealerWin = (this.CalculateDealerWinStraight() * 1) + (this.CalculateDealerWinOnDouble() * 2);
            return this.CostWeightedDealerWin;
        }

        public double CalculatePlayerWinOnDouble()
        {
            return (double)this.WinningDoubles / this.TotalNonPushingHands;
        }

        public double CalculatePlayerWinOnBJ()
        {
            return (double)this.PlayerBlackJacks / this.TotalNonPushingHands;
        }

        public double CalculatePlayerWinStraight()
        {
            return (double)(this.PlayerWins - (this.WinningDoubles + this.PlayerBlackJacks)) / this.TotalNonPushingHands;
        }

        public double CalculatePlayerProb()
        {
            this.PlayerProbability = (double)this.PlayerWins / this.TotalNonPushingHands;
            return this.PlayerProbability;
        }

        public double CalculateCostWeightedPlayerWin()
        {
            this.CostWeightedPlayerWin = (this.CalculatePlayerWinStraight() * 1) + (this.CalculatePlayerWinOnDouble() * 2) + (this.CalculatePlayerWinOnBJ() * 1.5);
            return CostWeightedPlayerWin;
        }

        public double CalculateUnweightedHouseAdv()
        {
            return this.DealerProbability - this.PlayerProbability;
        }

        public double CalculateWeightedHouseAdv()
        { 
            return this.CostWeightedDealerWin - this.CostWeightedPlayerWin;
        }

        public int CalculateTotalHands()
        {
            return this.DealerWins + this.PlayerWins + this.Pushes;
        }
    }
}
